home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 6 / CU Amiga Magazine's Super CD-ROM 06 (1996)(EMAP Images)(GB)(Track 1 of 4)[!][issue 1997-01].iso / cucd / online / awebgetmail / rexx / getmail.rexx < prev    next >
OS/2 REXX Batch file  |  1996-10-24  |  3KB  |  117 lines

  1. /* GetMail ARexx script for AWeb
  2.  
  3.    Version 1.1
  4.  
  5.    By Jeff Dettman (tomeeee@soho.ios.com)
  6.  
  7.    Description:
  8.    ------------
  9.    This script can be used to poll your POPHost for mail and will
  10.    display the results under AWeb (have mail, here it is; have no mail;
  11.    AmiTCP isn't running)
  12.  
  13.    Requires:
  14.    ---------
  15.    GetMail3.lha from comm/tcp
  16.  
  17.    Notes:
  18.    ------
  19.    This script is set up to automatically delete the mail from your
  20.    POPHost server.  If you wish to change this, remove the word
  21.    'delete' from the command parameters on line 43
  22.  
  23. */
  24.  
  25. /* change these options for your account */
  26.  
  27. /* optional if using AmiTCP and AmiTCP login name is the SAME as POPHost login name */
  28. user = 'your_user_name'                    /*e.g  user = 'tomeeee'*/
  29.  
  30. /* Manditory to get mail from POPHost */
  31.  
  32. password = 'yourpassword'
  33.  
  34. /* optional if AmiTCP has entry for POPHost in AmiTCP:db/hosts */
  35. /* see getmail.doc for information on this topic */
  36.  
  37. pophost = 'your_pophost'
  38.  
  39. /* optional but recommended */
  40.  
  41. emailaddr = 'your_email_adress'
  42.  
  43.  
  44. /* internal use, don't modify the following */
  45.  
  46. home = 'T:'
  47. mailfile = 'GetMail.tempfile'
  48.  
  49. /* MAIN SCRIPT */
  50.  
  51. /*options results*/
  52.  
  53. address command
  54. 'c:GetMail user='user 'password='password 'pophost='pophost 'home='home 'mail='mailfile 'delete'
  55.  
  56.  
  57.  
  58. if rc ~= 20 then do
  59.  if exists('T:GetMail.tempfile') then do
  60.   address command 'rx trimmail.rexx'
  61.   end
  62. if ~exists('T:GetMail.tempfile')  then do
  63.   address command  'echo >T:GetMail.HaveNone "<HTML><HEAD><TITLE>Mail Message</TITLE></HEAD><BODY><H1>Mail Message</H1>"'
  64.   'echo >>T:GetMail.HaveNone "<HR><PRE>Sorry, no mail was found at this time</PRE><HR>"'
  65.     /* Load the temp file into AWeb.
  66.      Use the RELOAD switch to force the file to be reloaded */
  67.   address AWEB.1 'open file://localhost/t:GetMail.HaveNone reload'
  68.   address command 'delete t:GetMail.HaveNone'
  69.             'delete t:GetMail.HaveSome'
  70.    exit
  71.  end
  72. end
  73. if rc = 20 then do
  74.   address command
  75.   'echo >T:AmiTCP.notrunning "<HTML><HEAD><TITLE>ERROR!</TITLE></HEAD><PRE>"'
  76.   'echo >>T:AmiTCP.notrunning "<BODY><H1>AmiTCP is required to be running</H1>"'
  77.      /*  Load the temp file into AWeb.
  78.      Use the RELOAD switch to force the file to be reloaded*/
  79.   address AWEB.1 'open file://localhost/t:AmiTCP.notrunning reload'
  80.   address command 'delete t:AmiTCP.notrunning'
  81.      exit
  82.    end
  83.   else do
  84.   /* Load the temp file into AWeb.
  85.      Use the RELOAD switch to force the file to be reloaded */
  86.  
  87.  call ht
  88. address AWEB.1 'open file://localhost/t:from.html reload'
  89.  end
  90. /* address command 'delete t:GetMail.HaveSome'*/
  91.  /* address command  'delete t:Getmail.HaveSome'*/
  92.   exit
  93. end
  94.  
  95.  
  96.  
  97.  
  98. return 0
  99. ht:
  100. open(p1,'t:from.html',w)
  101. open(3,'T:GetMail1.temp',r)
  102. a=0
  103. call writeln(p1,"<HTML><HEAD><TITLE>E-Mail Messages</TITLE></HEAD><BODY><H1>E-Mail Messages</H1>")
  104. call writeln(p1,"<HR><PRE>You have the following message(s) from:")
  105. call writeln(p1,"")
  106. call writeln(p1,"")
  107. call writeln(p1,'<ul>')
  108. Do until eof(3)
  109.  a=a+1
  110. line=readln(3)
  111. call writeln(p1,'<li><a href=message.'a'>'compress(line,'<,>')'</a>')
  112. end
  113. call writeln(p1,"</PRE><HR>")
  114. call writeln(p1,"<A href=x-aweb:rexx/delete.rexx>Delete Messages</A> <A href=x-aweb:rexx/save.rexx>Save Messages</A>")
  115. close(p1)
  116. return 0
  117.